﻿using System.Collections.Generic;
namespace GX
{
    public class DataManagerService:IDataManager
    {
        readonly Dictionary<int, IAppData> _dataMap = new Dictionary<int, IAppData>();

        public bool Register(int id,IAppData data)
        {
            IAppData existData;
            if (_dataMap.TryGetValue(id, out existData))
                return existData != data;
            _dataMap[id] = data;
            return true;
        }
        public IAppData Get(int id)
        {
            IAppData data = null;
            _dataMap.TryGetValue(id,out data);
            return data;
        }
    }
}